package com.arch.dev.server.bean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "users")
public class User extends AbstractTimestampEntity{

	private String userName;
	
	private Boolean enabled;
	
	@Column(name = "enabled")
	public Boolean getEnabled() {
		return enabled;
	}

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	@Id
	@Column(name = "USERNAME", unique = true, nullable = false)
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	private String passWord;

	@Column(name = "PASSWORD", nullable = true)
	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	
	private Authority authority;
	
	@OneToOne(cascade={javax.persistence.CascadeType.ALL})
	@PrimaryKeyJoinColumn
	public Authority getAuthority() {
		return authority;
	}

	public void setAuthority(Authority authority) {
		this.authority = authority;
	}

	public User() {

	}

	@Override
	public String toString() {

		return new String("username : " + userName + " password : " + passWord);

	}

}
